home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 April: Mac OS SDK / Dev.CD Apr 99 SDK1.toast / Development Kits / Interfaces&Libraries / Universal / Interfaces / RIncludes / Quickdraw.r < prev    next >
Encoding:
Text File  |  1998-08-17  |  13.3 KB  |  411 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        Quickdraw.r
  3.  
  4.      Contains:    Interface to Quickdraw Graphics
  5.  
  6.      Version:    Technology:    Mac OS 8.1
  7.                  Release:    Universal Interfaces 3.2
  8.  
  9.      Copyright:    © 1985-1998 by Apple Computer, Inc., all rights reserved
  10.  
  11.      Bugs?:        For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. */
  17.  
  18. #ifndef __QUICKDRAW_R__
  19. #define __QUICKDRAW_R__
  20.  
  21. #ifndef __CONDITIONALMACROS_R__
  22. #include "ConditionalMacros.r"
  23. #endif
  24.  
  25. #ifndef OLDPIXMAPSTRUCT
  26. #if TARGET_OS_MAC
  27. #define OLDPIXMAPSTRUCT 1
  28. #else
  29. #define OLDPIXMAPSTRUCT 0
  30. #endif
  31. #endif
  32. #ifndef OLDGDEVICESTRUCT
  33. #if TARGET_OS_MAC
  34. #define OLDGDEVICESTRUCT 1
  35. #else
  36. #define OLDGDEVICESTRUCT 0
  37. #endif
  38. #endif
  39.  
  40. /*----------------------------acur • Cursor Pointers -----------------------------------*/
  41. type 'acur' {
  42.        integer = $$CountOf(CursIdArray); /* Nbr of cursors                 */
  43.        fill word;                        /* Next frame to show             */
  44.        array CursIdArray {
  45.            integer;                      /* 'CURS' resource id for a frame */
  46.            fill word;                    /* Pad word to make longint       */
  47.        };
  48. };
  49.  
  50.  
  51. /*---------------------------clut • Generic Color Lookup Table---------------------------*/
  52. /*
  53.     clut_RezTemplateVersion:
  54.         0 - original 
  55.         1 - implicit header, auto index value                 <-- default
  56. */
  57. #ifndef clut_RezTemplateVersion
  58.     #ifdef oldTemp                            /* grandfather in use of “oldTemp” */
  59.         #define clut_RezTemplateVersion 0
  60.     #else
  61.         #define clut_RezTemplateVersion 1
  62.     #endif
  63. #endif
  64.  
  65. type 'clut' {
  66.     #if clut_RezTemplateVersion == 0
  67.         unsigned hex longint;                                    /* ctSeed                */
  68.         integer;                                                /* ctFlags                */
  69.     #else
  70.         unsigned hex longint = 0;                                /* ctSeed                */
  71.         integer = 0;                                            /* ctFlags                */
  72.     #endif
  73.         integer = $$Countof(ColorSpec) - 1;                        /* ctSize                */
  74.         wide array ColorSpec {
  75.     #if clut_RezTemplateVersion == 0
  76.                 integer;                                        /* value                */
  77.     #else
  78.                 integer = $$ArrayIndex(ColorSpec) - 1;            /* value                */
  79.     #endif
  80.                 unsigned integer;                                /* RGB:    red                */
  81.                 unsigned integer;                                /*        green            */
  82.                 unsigned integer;                                /*        blue            */
  83.         };
  84. };
  85.  
  86.  
  87. /*----------------------------------- common macros ---------------------------------------*/
  88.  
  89. #define    PixMapHeight    ( $$BitField(Bounds, 32, 16) /* bottom */            \
  90.                         - $$BitField(Bounds, 0, 16) /* top */ )
  91. #define    PixMapWidth        ( $$BitField(Bounds, 48, 16) /* right */            \
  92.                         - $$BitField(Bounds, 16, 16) /* left */ )
  93. #define    PixMapBounds    integer = $$BitField(Bounds, 0, 16) /* top */;        \
  94.                         integer = $$BitField(Bounds, 16, 16) /* left */;    \
  95.                         integer = $$BitField(Bounds, 32, 16) /* bottom */;    \
  96.                         integer = $$BitField(Bounds, 48, 16) /* right */
  97. #define    PixMapRowBytes    (((PixMapWidth * $$Word(PixelSize) + 15) / 16) * 2)
  98. #define    BitMapRowBytes    (((PixMapWidth + 15) / 16) * 2)
  99.  
  100. #define    PixMapHeightIndexed        ( $$BitField(Bounds[$$ArrayIndex(PixPatArray)], 32, 16) /* bottom */            \
  101.                                 - $$BitField(Bounds[$$ArrayIndex(PixPatArray)], 0, 16) /* top */ )
  102. #define    PixMapWidthIndexed        ( $$BitField(Bounds[$$ArrayIndex(PixPatArray)], 48, 16) /* right */            \
  103.                                 - $$BitField(Bounds[$$ArrayIndex(PixPatArray)], 16, 16) /* left */ )
  104. #define    PixMapRowBytesIndexed    (((PixMapWidthIndexed * $$Word(PixelSize[$$ArrayIndex(PixPatArray)]) + 15) / 16) * 2)
  105.  
  106.  
  107. /* RGB colors */
  108. #define whiteRGB $FFFF, $FFFF, $FFFF
  109. #define blackRGB 0, 0, 0
  110.  
  111. /* colors for 'crsr' resources */
  112. #define transparentRGB $FFFF, $FFFF, $FFFF
  113. #define invertRGB 0, 0, 0
  114.  
  115.  
  116. /*------------------------crsr • old Color Cursor template----------------------------------*/
  117. /*
  118.     crsr_RezTemplateVersion:
  119.         0 - original 
  120.         1 - color plus simplified source format             <-- default
  121. */
  122. #ifndef crsr_RezTemplateVersion
  123.     #ifdef oldTemp                            /* grandfather in use of “oldTemp” */
  124.         #define crsr_RezTemplateVersion 0
  125.     #else
  126.         #define crsr_RezTemplateVersion 1
  127.     #endif
  128. #endif
  129.  
  130.  
  131. type 'crsr' {
  132.     #if crsr_RezTemplateVersion == 0
  133.         hex unsigned integer    oldCursor   = $8000,            /* Type of cursor        */
  134.                                 colorCursor = $8001;
  135.     #else
  136.         unsigned hex integer = $8001;                            /* Type of cursor        */
  137.     #endif        
  138.         unsigned longint = pixMap / 8;                            /* Offset to pixMap        */
  139.         unsigned longint = pixelData / 8;                        /* Offset to pixel data    */
  140.         fill long;                                                /* Expanded cursor data    */
  141.         fill word;                                                /* Expanded data depth    */
  142.         fill long;                                                /* Reserved                */
  143.         hex string [32];                                        /* One bit cursor data    */
  144.         hex string [32];                                        /* One bit cursor mask    */
  145.         point;                                                    /* Hot spot             */
  146.         fill long;                                                /* Table id                */
  147.         fill long;                                                /* id for cursor        */
  148.  
  149.         /* IconPMap (pixMap) record */
  150.     pixMap:
  151.         fill long;                                                /* Base address            */
  152.         unsigned bitstring[1] = 1;                                /* New pixMap flag        */
  153.         unsigned bitstring[2] = 0;                                /* Must be 0            */
  154.     #if    crsr_RezTemplateVersion == 0    
  155.         unsigned bitstring[13];                                    /* Offset to next row    */
  156.         rect;                                                    /* Bitmap bounds        */
  157.         integer;                                                /* pixMap version number*/
  158.         integer    unpacked;                                        /* Packing format        */
  159.         unsigned longint;                                        /* Size of pixel data    */
  160.         unsigned hex longint;                                    /* h. resolution (ppi) (fixed) */
  161.         unsigned hex longint;                                    /* v. resolution (ppi) (fixed) */
  162.         integer            chunky, chunkyPlanar, planar;            /* Pixel storage format    */
  163.         integer;                                                /* # bits in pixel        */
  164.         integer;                                                /* # components in pixel*/
  165.         integer;                                                /* # bits per field        */
  166.         unsigned longint;                                        /* Offset to next plane    */
  167.         unsigned longint = colorTable / 8;                        /* Offset to color table*/
  168.         fill long;                                                /* Reserved                */
  169.  
  170.     pixelData:
  171.         hex string [(colorTable - pixelData) / 8];                /* Pixel data            */
  172.     #else
  173.  
  174.  
  175.     pMapRowBytes:
  176.         unsigned bitstring[13] = PixMapRowBytes;                /* Offset to next row    */
  177.  
  178.     Bounds:    
  179.         rect = { 0, 0, 16, 16 };                                /* Bitmap bounds        */
  180.         integer = 0;                                            /* pixMap vers number    */
  181.         integer = 0;                                            /* Packing format        */
  182.         fill long;                                                /* Size of pixel data    */
  183.         unsigned hex longint = $00480000;                        /* h. resolution (ppi)  */
  184.         unsigned hex longint = $00480000;                        /* v. resolution (ppi)  */
  185.         integer = 0 /* chunky */;                                /* Pixel storage format    */
  186.     PixelSize:
  187.         integer;                                                /* # bits in pixel        */
  188.         integer = 1;                                            /* # components in pixel*/
  189.         integer = $$Word(PixelSize);                            /* # bits per field        */
  190.         fill long;
  191.         unsigned longint = ColorTable / 8;
  192.         fill long;
  193.  
  194.     PixelData:
  195.         hex string [PixMapRowBytes * PixMapHeight];
  196.     #endif
  197.  
  198.         /* Color Table */
  199.     colorTable:
  200.         unsigned hex longint;                                    /* ctSeed                */
  201.         integer;                                                /* ctFlags                */
  202.         integer = $$Countof(ColorSpec) - 1;                        /* ctSize                */
  203.         wide array ColorSpec {
  204.                 integer;                                        /* value                */
  205.                 unsigned integer;                                /* RGB:    red                */
  206.                 unsigned integer;                                /*        green            */
  207.                 unsigned integer;                                /*        blue            */
  208.         };
  209. };
  210.  
  211.  
  212. /*----------------------------CURS • Cursor---------------------------------------------*/
  213. type 'CURS' {
  214.         hex string [32];                                        /* Data                 */
  215.         hex string [32];                                        /* Mask                 */
  216.         point;                                                    /* Hot spot             */
  217. };
  218.  
  219.  
  220. /*----------------------------PAT  • Quickdraw Pattern----------------------------------*/
  221. type 'PAT ' {
  222.         hex string[8];                                            /* Pattern                */
  223. };
  224.  
  225.  
  226. /*----------------------------PAT# • Quickdraw Pattern List-----------------------------*/
  227. type 'PAT#' {
  228.         integer = $$Countof(PatArray);
  229.         array PatArray {
  230.                 hex string[8];                                    /* Pattern                */
  231.         };
  232. };
  233.  
  234.  
  235. /*----------------------------PICT • Quickdraw Picture----------------------------------*/
  236. #ifndef __PICT_R__
  237.     #ifndef PICT_RezTemplateVersion
  238.         #define PICT_RezTemplateVersion 0
  239.     #endif
  240.     #ifndef __PICTUTILS_R__
  241.         #include "PictUtils.r"
  242.     #endif
  243. #endif __PICT_R__
  244.  
  245.  
  246. /*------------------------ppat • Pixel Pattern old template---------------------------------*/
  247. /*
  248.     ppat_RezTemplateVersion:
  249.         0 - original 
  250.         1 - color plus simplified source format             <-- default
  251. */
  252. #ifndef ppat_RezTemplateVersion
  253.     #ifdef oldTemp                            /* grandfather in use of “oldTemp” */
  254.         #define ppat_RezTemplateVersion 0
  255.     #else
  256.         #define ppat_RezTemplateVersion 1
  257.     #endif
  258. #endif
  259.  
  260.  
  261. type 'ppat' {
  262.     #if ppat_RezTemplateVersion == 0 
  263.         /* PixPat record */
  264.         integer        oldPattern,                                    /* Pattern type            */
  265.                     newPattern,
  266.                     ditherPattern;
  267.     #else
  268.         integer = 1 /* newPattern */;                            /* Pattern type            */
  269.     #endif
  270.         unsigned longint = PixMap / 8;                            /* Offset to pixmap        */
  271.         unsigned longint = PixelData / 8;                        /* Offset to data        */
  272.         fill long;                                                /* Expanded pixel image    */
  273.         fill word;                                                /* Pattern valid flag    */
  274.         fill long;                                                /* expanded pattern        */
  275.         hex string [8];                                            /* old-style pattern    */
  276.  
  277.         /* PixMap record */
  278.     PixMap:
  279.         fill long;                                                /* Base address            */
  280.         unsigned bitstring[1] = 1;                                /* New pixMap flag        */
  281.         unsigned bitstring[2] = 0;                                /* Must be 0            */
  282.     #if ppat_RezTemplateVersion == 0 
  283.         unsigned bitstring[13];                                    /* Offset to next row    */
  284.         rect;                                                    /* Bitmap bounds        */
  285.         integer;                                                /* pixMap vers number    */
  286.         integer        unpacked;                                    /* Packing format        */
  287.         unsigned longint;                                        /* size of pixel data    */
  288.         unsigned hex longint;                                    /* h. resolution (ppi) (fixed) */
  289.         unsigned hex longint;                                    /* v. resolution (ppi) (fixed) */
  290.         integer            chunky, chunkyPlanar, planar;            /* Pixel storage format    */
  291.         integer;                                                /* # bits in pixel        */
  292.         integer;                                                /* # components in pixel*/
  293.         integer;                                                /* # bits per field        */
  294.         unsigned longint;                                        /* Offset to next plane    */
  295.         unsigned longint = ColorTable / 8;                        /* Offset to color table*/
  296.         fill long;                                                /* Reserved                */
  297.  
  298.     PixelData:
  299.         hex string [(ColorTable - PixelData) / 8];
  300.     #else
  301.  
  302.  
  303.     pMapRowBytes:
  304.         unsigned bitstring[13] = PixMapRowBytes;                /* Offset to next row    */
  305.     Bounds:    rect;                                                    /* Bitmap bounds        */
  306.         integer = 0;                                            /* pixMap vers number    */
  307.         integer = 0;                                            /* Packing format        */
  308.         fill long;                                                /* Size of pixel data    */
  309.         unsigned hex longint = $00480000;                        /* h. resolution (ppi)  */
  310.         unsigned hex longint = $00480000;                        /* v. resolution (ppi)  */
  311.         integer = 0 /* chunky */;                                /* Pixel storage format    */
  312.     PixelSize:
  313.         integer;                                                /* # bits in pixel        */
  314.         integer = 1;                                            /* # components in pixel*/
  315.         integer = $$Word(PixelSize);                            /* # bits per field        */
  316.         fill long;
  317.         unsigned longint = ColorTable / 8;
  318.         fill long;
  319.  
  320.     PixelData:
  321.         hex string [PixMapRowBytes * PixMapHeight];
  322.     #endif
  323.     
  324.     ColorTable:
  325.         unsigned hex longint;                                    /* ctSeed                */
  326.         integer;                                                /* ctFlags                */
  327.         integer = $$Countof(ColorSpec) - 1;                        /* ctSize                */
  328.         wide array ColorSpec {
  329.     #if ppat_RezTemplateVersion == 0
  330.                 integer;                                        /* value                */
  331.     #else
  332.                 integer = $$ArrayIndex(ColorSpec) - 1;            /* value                */
  333.     #endif
  334.                 unsigned integer;                                /* RGB:    red                */
  335.                 unsigned integer;                                /*        green            */
  336.                 unsigned integer;                                /*        blue            */
  337.         };
  338. };
  339.  
  340.  
  341. /*----------------------------ppt# • list of pixpats;--------------------------------------*/
  342. type 'ppt#' {
  343.                                             /* PixPat offsets (calculate them some day!?!) */
  344.     integer = $$CountOf(OffsetArray);
  345.     array OffsetArray {                         /* [$$CountOf(PixPatArray)] */ 
  346.         unsigned longint                     /* = PixPat[$$ArrayIndex(OffsetArray)] / 8 */;
  347.     };
  348.  
  349.     array PixPatArray {
  350.     PixPat:
  351.         /* PixPat record */
  352.         integer = 1 /* newPattern */;                            /* Pattern type            */
  353.         unsigned longint = PixMap[$$ArrayIndex(PixPatArray)] / 8;    /* Offset to pixmap        */
  354.         unsigned longint = PixelData[$$ArrayIndex(PixPatArray)] / 8;    /* Offset to data        */
  355.         fill long;                                                /* Expanded pixel image    */
  356.         fill word;                                                /* Pattern valid flag    */
  357.         fill long;                                                /* expanded pattern        */
  358.         hex string [8];                                            /* old-style pattern    */
  359.     
  360.         /* PixMap record */
  361.     PixMap:
  362.         fill long;                                                /* Base address            */
  363.         unsigned bitstring[1] = 1;                                /* New pixMap flag        */
  364.         unsigned bitstring[2] = 0;                                /* Must be 0            */
  365.     pMapRowBytesIndexed:
  366.         unsigned bitstring[13] = PixMapRowBytesIndexed;            /* Offset to next row    */
  367.     Bounds:        
  368.         rect;                                                    /* Bitmap bounds        */
  369.         integer = 0;                                            /* pixMap vers number    */
  370.         integer = 0;                                            /* Packing format        */
  371.         fill long;                                                /* Size of pixel data    */
  372.         unsigned hex longint = $00480000;                        /* h. resolution (ppi)  */
  373.         unsigned hex longint = $00480000;                        /* v. resolution (ppi)  */
  374.         integer = 0 /* chunky */;                                /* Pixel storage format    */
  375.     PixelSize:
  376.         integer;                                                /* # bits in pixel        */
  377.         integer = 1;                                            /* # components in pixel*/
  378.         integer = $$Word(PixelSize[$$ArrayIndex(PixPatArray)]);    /* # bits per field        */
  379.         fill long;
  380.         unsigned longint = ColorTable[$$ArrayIndex(PixPatArray)] / 8;
  381.         fill long;
  382.     
  383.     PixelData:
  384.         hex string [PixMapRowBytesIndexed * PixMapHeightIndexed];
  385.  
  386.     
  387.     ColorTable:
  388.         unsigned hex longint = 0;                                /* ctSeed                */
  389.         integer = 0;                                            /* ctFlags                */
  390.         integer = $$Countof(ColorSpec[$$ArrayIndex(PixPatArray)]) - 1;    /* ctSize                */
  391.         wide array ColorSpec {
  392.                 integer = $$ArrayIndex(ColorSpec[$$ArrayIndex(PixPatArray)]) - 1;/* value                */
  393.                 unsigned integer;                                /* RGB:    red                */
  394.                 unsigned integer;                                /*        green            */
  395.                 unsigned integer;                                /*        blue            */
  396.         };
  397.     };
  398. };
  399.  
  400.  
  401. /*----------------------------mitq • Default queue sizes for MakeITable--------------------------------------*/
  402. type 'mitq' {                /* default MakeITable queue sizes */
  403.     wide array [3] {
  404.         unsigned longint;    /* queue size for 3, 4, and 5 bit inverse tables */
  405.     };
  406. };
  407.  
  408.  
  409. #endif /* __QUICKDRAW_R__ */
  410.  
  411.